package bf.runner;
import java.io.FileReader;
import java.io.IOException;

import bf.program.Program;
import bf.program.State;
import bf.util.BrainfuckParser;

public class BrainfuckRunner {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		long time1 = System.currentTimeMillis();
		Program prog;
		try {
			prog = BrainfuckParser.parse(new FileReader(args[0]));
			State state = new State();
			prog.execute(state);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		long time2 = System.currentTimeMillis();
		System.out.println();
		System.out.println(time2 - time1 + " ms");
	}

}
